(function(clazz,id){
	var grid;
	var classdat 	= Get("/clazz/name/"+clazz).obj;
	var columns 	= _("entity.fun.getColumns")(classdat.fields); 
	
	
	var callback = function(clazz,pid){
		var data = _("entity.fun.getData")(clazz);
		Ext.getCmp(pid).store.loadData(data);
	}
	
	
	
	
	
	
	
	
	if(clazz=="itemsclass"){
		columns.push({
			xtype	: 'actioncolumn',
	        text	: "操作",  flex:1,
	        items	: [{
	        	icon	: "lib/ext/shared/icons/fam/grid.png",
	            tooltip	: "操作",
	            handler	: function(grid, rowIndex, colIndex) {
	            	log(grid.store.getAt(rowIndex).data.model);
	            	var id = grid.store.getAt(rowIndex).data.model+"_1";
	            	if(Ext.getCmp(id)!=null){
	            		Ext.getCmp(id).show();
	            	}else
	            	Ext.getCmp("centermain").add(
	            	_("items.list")(grid.store.getAt(rowIndex).data.model,id)).show();
	            	//_()();
	            	//_("entity.add.panel")(clazz,id,callback,grid.store.getAt(rowIndex).data);
	            }
	        }] 
		});
	}
	
	
	columns.push({
		xtype: 'actioncolumn',
        text:"修改",  flex:1,
        items: [{
        	icon: "lib/ext/shared/icons/fam/grid.png",
            tooltip: "修改",
            handler: function(grid, rowIndex, colIndex) {
            	_("entity.add.panel")(clazz,id,callback,grid.store.getAt(rowIndex).data);
            }
        }] 
	});
	
	columns.push({
		xtype: 'actioncolumn',
		text:"删除",  flex:1,
        items: [{
        	icon: "lib/ext/shared/icons/fam/delete.gif",
            tooltip: "删除",
            handler: function(grid, rowIndex, colIndex) {
            	_("entity.delete.onepanel")(clazz,id,callback,grid.store.getAt(rowIndex).data);
            }
        }] 
	});
	
	

	
	
	grid = {
		xtype		:	'gridpanel',
        id			:   id,
    	autoScroll	:	true,
        selModel	:	Ext.create('Ext.selection.CheckboxModel'),
        columns 	:	columns ,
        listeners   : {
        	show:function(){
        		//alert("sdf");
        		callback(clazz,id);
        		setCurrentClass(clazz);
        	}
        } 
	};
	grid["tbar"]	=	_("entity.fun.getTbar")(clazz,id,callback);
	grid["store"]	=	_("entity.fun.getStore")(clazz);
	return grid;
})